<ui:composition template="/main.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<ui:define name="content">
		<f:view locale="#{messageProvider.locale}">

			<p:commandButton action='create.xhtml?faces-redirect=false'
				value="#{webMsg['user.create']}">
			</p:commandButton>
			<h:form prependId="false">
				<p:commandButton action='#{userBean.delete}' update=":contentPanel"
					value="#{webMsg['user.delete']}">
					<p:confirm header="#{webMsg['confirm.header']}"
						message="#{webMsg['delete.confirm']}" icon="ui-icon-alert" />
				</p:commandButton>
				<p:confirmDialog global="true" showEffect="fade"
					hideEffect="explode">
					<p:commandButton value="#{webMsg['confirm.yes']}" type="button"
						styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
					<p:commandButton value="#{webMsg['confirm.no']}" type="button"
						styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</p:confirmDialog>

				<br />
				<br />
				<p:dataTable id="dataTable" var="user"
					value="#{userBean.userDataModel}"
					selection="#{userBean.selectedUsers}" paginator="true" rows="10"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="5,10,15">
					<f:facet name="header">
						<h:outputText value="#{webMsg['user.list']}" />
					</f:facet>
					<p:column selectionMode="multiple" style="width:2%" />
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{webMsg['user.username']}" />
						</f:facet>
						<h:outputText value="#{user.username}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{webMsg['user.email']}" />
						</f:facet>
						<h:outputText value="#{user.email}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{webMsg['user.mobile']}" />
						</f:facet>
						<h:outputText value="#{user.mobile}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{webMsg['user.description']}" />
						</f:facet>
						<h:outputText value="#{user.description}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{webMsg['delete']}" />
						</f:facet>
						<p:commandButton action='#{userBean.deleteSingle}'
							update=":contentPanel" value="#{webMsg['delete']}">
							<f:setPropertyActionListener target="#{userBean.user}"
								value="#{user}" />
							<p:confirm header="#{webMsg['confirm.header']}"
								message="#{webMsg['delete.confirm']}" icon="ui-icon-alert" />
						</p:commandButton>
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{webMsg['edit']}" />
						</f:facet>
						<p:commandButton action='edit?faces-redirect=false'
							update=":contentPanel" value="#{webMsg['edit']}">
							<f:setPropertyActionListener target="#{userBean.user}"
								value="#{user}" />
						</p:commandButton>
					</p:column>
				</p:dataTable>

			</h:form>
		</f:view>
	</ui:define>
</ui:composition>